package com.zhangyu.shadow.ec.main.discover;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.zhangyu.shadow.core.app.ConfigType;
import com.zhangyu.shadow.core.app.Shadow;
import com.zhangyu.shadow.core.delegate.IPageLoadListener;
import com.zhangyu.shadow.core.delegate.bottom.BottomItemDelegate;
import com.zhangyu.shadow.core.delegate.web.WebDelegateImpl;
import com.zhangyu.shadow.ec.R;

/**
 * @author zhangyu
 * @date 2017/11/9
 */

public class DiscoverDelegate extends BottomItemDelegate {
    @Override
    public Object setLayout() {
        return R.layout.delegate_discover;
    }

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {

    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
        String webHost = Shadow.getConfiguration(ConfigType.WEB_HOST);
        final WebDelegateImpl webDelegate = WebDelegateImpl.create(webHost);
        webDelegate.setIPageLoadListener(new IPageLoadListener() {
            @Override
            public void onLoadStart() {

            }

            @Override
            public void onLoadEnd() {

            }
        });
        webDelegate.setTopDelegate(this.getParentDelegate());
        getSupportDelegate().loadRootFragment(R.id.web_discover_container, webDelegate);
    }


}
